package com.yenlien.traceyun.control.dao;

import com.yenlien.traceyun.control.entity.CompanyModelCategory;
import com.yenlien.traceyun.webase.dao.BaseJpaDao;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: bigwangy@sina.com
 * @create: 2020-11-19
 * @description:
 **/
public interface CompanyModelCategoryDao extends BaseJpaDao<CompanyModelCategory> {

    @Transactional
    public void deleteByCompanyId(String companyId);

    /**
     * 根据分类统计数量
     *
     * @param categoryId
     * @return
     */
    public int countByCategoryId(String categoryId);

    @Query("select cm.categoryId from CompanyModelCategory cm where cm.companyId=?1")
    public List<String> findByCompanyId(String companyId);
}
